﻿@model IEnumerable<HanGu.Entity.Message>
@{
    Layout = null;
    int i = 1;
    ViewBag.ViewTitle = "信息";
    var SearchParma = ViewData["SearchParma"] as HanGu.Entity.UniversallySearchParam;
    var members = ViewData["members"] as SelectList;
    var AccessCusType = ViewData["AccessCusType"] as SelectList;
}
<div class="pageContent">
    <script>
        function DeletingMsg(url) {
            var $this = $("#deleteMSgButton");
            //var oHref = $this.attr("ref");
            //$this.attr("href", oHref.replace("{Message_id}", id));
            $this.attr("href", url);
        }

        function refreshMemberMsg() {
            $this = $("#MsgByMemberDiv");
            $this.loadUrl($this.attr("rel"));
        }
        function DeleteedMsg(obj) {
            $this = $(obj);
            var url = unescape($this.attr("href"));
            DWZ.debug(url);
            if (!url.isFinishedTm()) {
                alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
                return false;
            }
            var title = $this.attr("title");
            if (title) {
                alertMsg.confirm(title, {
                    okCall: function () {
                        ajaxTodo(url, refreshMemberMsg);
                    }
                });
            } else {
                ajaxTodo(url, refreshMemberMsg);
            }
            return false;
        }
    </script>
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="icon" href="/Message/Default/{Message_id}?action=view" height="500"
                width="850" target="dialog" title="查看信息"><span>查看详细</span></a></li>
            <li><a class="delete memberMsg" id="deleteMSgButton" title="确认删除吗？" onclick="return DeleteedMsg(this);"
                href="/Message/Default/Delete/{Message_id}?OpID=Message_3" ref="/Message/Default/Delete/{Message_id}?OpID=Message_3"
                warn="请选择一条记录"><span>删除</span></a></li>
        </ul>
    </div>
    <table class="table" width="100%">
        <thead>
            <tr class="header">
                <th style="width: 30px">
                    序号
                </th>
                <th>
                    类型
                </th>
                <th>
                    标题
                </th>
                <th>
                    内容
                </th>
                <th>
                    创建人
                </th>
                <th>
                    创建时间
                </th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {
            var action = "email";
            action = item.Type == 2 ? "Email" : (item.Type == 3 ? "SMS" : "Create");                      
            <tr target="Message_id" rel="@action/@item.ID/@item.GUID" onclick="DeletingMsg('/Message/Default/DeleteMessageItem/@item.ID/@ViewData["MsgMemberID"]?OpID=Message_3')">
                <td>
                    @i
                </td>
                <td>
                    @{
            var tmpType = AccessCusType.Where(c => c.Value == item.Type.ToString()).FirstOrDefault();
            if (tmpType != null)
            { 
                        @tmpType.Text
            }          
                    }
                </td>
                <td>
                    @item.Title
                </td>
                <td>
                    @MvcHtmlString.Create(item.Remark)
                </td>
                <td>
                    @item.Creator
                </td>
                <td>
                    <span formatdate="yyyy-MM-dd HH:mm">
                        @item.CreateTime</span>
                </td>
            </tr>
            i += 1;
        }
    </table>
</div>
